package com.aoxun.android.landlord.common;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

/**
 * Created by huanglong on 2017/11/20.
 * Gson 线程安全，单例，方便配置
 */

public class GsonUtil {
    private static GsonUtil gsonUtil;
    private final Gson gson;

    public static GsonUtil getInstance(){
        if (gsonUtil == null) {
            synchronized(GsonUtil.class){
                if (gsonUtil==null) {
                    gsonUtil = new GsonUtil();
                }
            }
        }
        return gsonUtil;
    }

    public Gson getGson() {
        return gson;
    }

    private GsonUtil(){
        //自己配置
        GsonBuilder builder = new GsonBuilder();
        //builder.setVersion(1.0);
        gson = builder.create();
    }


}
